{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "101f2004",
   "metadata": {},
   "source": [
    "## ch01/avg.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "00516010",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.5488135039273248\n",
      "0.6320014351498722\n",
      "0.6222554154571295\n",
      "0.6029123573420713\n",
      "0.567060845741438\n",
      "0.5801997236289743\n",
      "0.5598265075766483\n",
      "0.6013198192273272\n",
      "0.6415801460355164\n",
      "0.6157662833145425\n",
      "---\n",
      "0.5488135039273248\n",
      "0.6320014351498722\n",
      "0.6222554154571294\n",
      "0.6029123573420713\n",
      "0.567060845741438\n",
      "0.5801997236289743\n",
      "0.5598265075766483\n",
      "0.6013198192273272\n",
      "0.6415801460355164\n",
      "0.6157662833145425\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# naive implementation\n",
    "np.random.seed(0)\n",
    "rewards = []\n",
    "\n",
    "for n in range(1, 11):\n",
    "    reward = np.random.rand()\n",
    "    rewards.append(reward)\n",
    "    Q = sum(rewards) / n\n",
    "    print(Q)\n",
    "\n",
    "print('---')\n",
    "\n",
    "# incremental implementation\n",
    "np.random.seed(0)\n",
    "Q = 0\n",
    "\n",
    "for n in range(1, 11):\n",
    "    reward = np.random.rand()\n",
    "    Q = Q + (reward - Q) / n\n",
    "    print(Q)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "37c5751d",
   "metadata": {},
   "source": [
    "## ch01/bandit.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "88758ac9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "865\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEGCAYAAACKB4k+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQ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Vlvn8drNPJ3b919/sJnYGU7e5YJCJ0piByYA2A58wsidA42MsJNSUNB6ab2Tp3PyVoUhpnZrWD7e4j1BsvQBMzWwDsDbYDeDIIGyPUC+b8qtgZkfLoQrNImJW9IB3pWkQORM1HIiJSSmcKIiJSSmcKIiJSSqEgIiKlFAoiIlJKoSAiIqUUCiIiUur/A65WJESCJutiAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEGCAYAAABo25JHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAiRElEQVR4nO3deXRc9X338fdX+y5Zi1fZlo1tiLBZVYPJRgIkJqQ4JECAJJA2DafnlDYtPX1Cmh6SQtM+Sfpka3nSEJ4spQmEpGnrEj/hCYSlZTG22Yw3LLzKm2Rr36WZ7/PH3JFm5LEtL6OxdD+vc3R05947M9+ra89nfr/fXczdERGR8MrKdAEiIpJZCgIRkZBTEIiIhJyCQEQk5BQEIiIhl5PpAk5WdXW119XVZboMEZFJZcOGDYfdvSbVskkXBHV1daxfvz7TZYiITCpmtvtYy9Q1JCIScgoCEZGQUxCIiIScgkBEJOQUBCIiIacgEBEJOQWBiEjITbrzCERkanF3hiJOXk4W/UMRmtr62NvWS1NbHwNDEWqnFXLZgioqinIxs0yXOyUpCETkpLh70gfycCTKkZ5BakryGRiOUpiXPbKsbzDCntZemrv6mVFWwMGOfva09rK3tZc98Z8jvXQNDFNWkENn//Ax37cgN4s5FYVUl+TT0TdEZXEeHX1DdPYPUVWcT2cwrzg/hxll+ZQX5tLZN8ysioKR5+xr72N/ex+lBbkMDkeIRJ0733MOAAc6+tjX3seB9n6au/qpqyrmnOklVBX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j/USY6fd/Q/N7DLgOmCDmV3q7pP5KpkyBahFIJKCmZ1rZosTZl0E7Aa6gNJg3kvAOxP6/4vNbEnCcz6e8PvFYJ1z3H2tu99LrKWReOlgkYxQi0AktRLgH8ysgth9oRuJdRPdCvzazPa7+/uC7qJHzCw/eN5fEbvKLcA0M3sDGAieB/D1IGCM2NUlX5+IjRE5Hg0Wi6RB4qBypmsRORF1DYmIhJxaBCIiIacWgYhIyCkIRERCTkEgIhJyCgIRkZBTEIiIhNz/B7y2xZnnSV4UAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "class Bandit:\n",
    "    def __init__(self, arms=10):\n",
    "        self.rates = np.random.rand(arms)\n",
    "\n",
    "    def play(self, arm):\n",
    "        rate = self.rates[arm]\n",
    "        if rate > np.random.rand():\n",
    "            return 1\n",
    "        else:\n",
    "            return 0\n",
    "\n",
    "\n",
    "class Agent:\n",
    "    def __init__(self, epsilon, action_size=10):\n",
    "        self.epsilon = epsilon\n",
    "        self.Qs = np.zeros(action_size)\n",
    "        self.ns = np.zeros(action_size)\n",
    "\n",
    "    def update(self, action, reward):\n",
    "        self.ns[action] += 1\n",
    "        self.Qs[action] += (reward - self.Qs[action]) / self.ns[action]\n",
    "\n",
    "    def get_action(self):\n",
    "        if np.random.rand() < self.epsilon:\n",
    "            return np.random.randint(0, len(self.Qs))\n",
    "        return np.argmax(self.Qs)\n",
    "\n",
    "\n",
    "steps = 1000\n",
    "epsilon = 0.1\n",
    "\n",
    "bandit = Bandit()\n",
    "agent = Agent(epsilon)\n",
    "total_reward = 0\n",
    "total_rewards = []\n",
    "rates = []\n",
    "\n",
    "for step in range(steps):\n",
    "    action = agent.get_action()\n",
    "    reward = bandit.play(action)\n",
    "    agent.update(action, reward)\n",
    "    total_reward += reward\n",
    "\n",
    "    total_rewards.append(total_reward)\n",
    "    rates.append(total_reward / (step + 1))\n",
    "\n",
    "print(total_reward)\n",
    "\n",
    "plt.ylabel('Total reward')\n",
    "plt.xlabel('Steps')\n",
    "plt.plot(total_rewards)\n",
    "plt.show()\n",
    "\n",
    "plt.ylabel('Rates')\n",
    "plt.xlabel('Steps')\n",
    "plt.plot(rates)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c1c746b5",
   "metadata": {},
   "source": [
    "## ch01/bandit_avg.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "24a72587",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEGCAYAAAB/+QKOAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAm7klEQVR4nO3deXxddZ3/8dcne7M1SZN035vSlrUQKBWQvVZQcFwLjoAijI4IP36OI6g/F/zNiM64zciPh6i4oYIiOpVhQBBQZG1aSulCaZo2TdLSZt/3fH5/3NNym6Y0aXN7knvfz8fjPnLP95yTfE5Oe9852/dr7o6IiMhgSWEXICIiY5MCQkREhqSAEBGRISkgRERkSAoIEREZUkrYBYyWwsJCnzNnTthliIiMK2vXrq1z96Kh5sVNQMyZM4eysrKwyxARGVfMrPJw83SKSUREhqSAEBGRISkgRERkSAoIEREZkgJCRESGpIAQEZEhKSBERGRIcfMchIhIvOrrH6Clq4/mzt5DXi2dveRnpnH1slmj/nMVECIiMdY/4LR09tLS1UtrVx9t3X20BV9bunpp7jj0g3//h39LsNxbOX1WngJCRCRM3X391Lf10NTRS1NHD02dvTR2RE139NIU9eHeGvzVf6QPeICM1CQmTkg98JqRP4HcabkHtQ31yp2QSkZqcky2VwEhIgK4O/XtPVQ3drKnqZPdzV3sbupkT3Mnu5u62NPcyb7Wbg43CGdGahL5mWkHPrhnFmSSm5FK7oSUy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i11h6iRwpXn80+xX4WLDt5cBHR1KDutoQEZEhJfopJhEROQwFhIiIDEkBISIiQ1JAiIjIkBQQIiIyJAWEyFEwsy8EvYluMLP1ZrbMzP6XmWWGXZvIaNFtriIjZGbLgW8DF7h7t5kVAmnAc0TuP68LtUCRUaIjCJGRmwrUuXs3QBAI7yfSL9BTZvYUgJmtMLPnzWydmf026BcLM9tpZt80s1fN7CUzWxC0fyAY3+AVM/trOJsm8iYdQYiMUPBB/zcgk8jTrA+4+1+CPqBK3b0uOKp4CHinu7eb2eeIPNl7R7DcD939X8zsGuCD7v4uM3sVWOnuNWaW5+5NYWyfyH46ghAZIXdvA84gMjBLLfCAmV03aLGziQxC9ayZrSfSb87sqPm/jvq6PHj/LPBTM7uByCA4IqFKOfIiIjKYu/cDTwNPB3/5Dx7K0YDH3f2qw32Lwe/d/RNmtgy4HFhrZme4+3jtdVTigI4gREbIzE4ws5KoptOASqAVyAnaXgDOibq+kGVmC6PW+VDU1+eDZea7+4vu/iUiRybR3TSLHHc6ghAZuWzgP80sj8jY3+VETjddBTxqZrvd/cLgtNOvzSw9WO+LRHoOBsg3sw1Ad7AewL8FwWNEeux85XhsjMjh6CK1yHEWfTE77FpE3opOMYmIyJB0BCEiIkPSEYSIiAxJASEiIkNSQIiIyJAUECIiMiQFhIiIDOn/AxRQ+JcgDsRrAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "runs = 200\n",
    "steps = 1000\n",
    "epsilon = 0.1\n",
    "all_rates = np.zeros((runs, steps))  # (2000, 1000)\n",
    "\n",
    "for run in range(runs):\n",
    "    bandit = Bandit()\n",
    "    agent = Agent(epsilon)\n",
    "    total_reward = 0\n",
    "    rates = []\n",
    "\n",
    "    for step in range(steps):\n",
    "        action = agent.get_action()\n",
    "        reward = bandit.play(action)\n",
    "        agent.update(action, reward)\n",
    "        total_reward += reward\n",
    "        rates.append(total_reward / (step + 1))\n",
    "\n",
    "    all_rates[run] = rates\n",
    "\n",
    "avg_rates = np.average(all_rates, axis=0)\n",
    "\n",
    "plt.ylabel('Rates')\n",
    "plt.xlabel('Steps')\n",
    "plt.plot(avg_rates)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d5c97bf8",
   "metadata": {},
   "source": [
    "## ch01/non_stationary.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "2d6378fc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEGCAYAAABo25JHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAA4E0lEQVR4nO3deXhU1fnA8e+bdbIvZGEJkLDvi7KKKC4oKkqrVUCtYluppVba/qpV64baqtXaVsXWFeuOu2BRXIqKiAiBACHshCUsCSRk3ybJ+f1xb8IQAkwwk0lm3s/zzDN3m8l758J57z333HPEGINSSin/FeDtAJRSSnmXJgKllPJzmgiUUsrPaSJQSik/p4lAKaX8XJC3A2iuhIQEk5qa6u0wlFKqXUlPTz9kjElsal27SwSpqamsWrXK22EopVS7IiK7jrdOq4aUUsrPaSJQSik/p4lAKaX8nCYCpZTyc5oIlFLKz2kiUEopP6eJQCml/Fy7e45AKaXaNWOgpgqqy8BZBtXl1ruzEmoq7PdKcJaDs8J61Tqhzgl9LoQup7d4SJoIlFKqKcZYhXB1GVSX2u+NphsK8nKXZY2nS61tXOdN3anFFNVRE4FSSjXJGOssuqrEejUU2scrxEsbLW+0XZW9nmYM3BUUBiHhEBIBwRFHpqNTGi231x01HQ5BDggOs95DIqzp+uWBIRAQCCIe+fk0ESilvKdxAV5VDJXFLvMlUFV0ZPpE6+pq3PubEgghkVZhG2q/h0RCVCd7OuLI+mOmG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GDPXv2EBsbS9euXRk3bhwA1157LU888QR/+MMfGv7ud999R1ZWVsM21dXVjB079pj4MjMzueuuuygsLKS0tJQLL7wQgKlTpzJ//nzOOecc3nzzTWbNmkVpaSnffvstV155ZcPnq6qqGqavvPJKAgMDASgqKuL6669n69atiAhOpxOAb775htmzZwMwaNAghgwZ0qx4W5v/lIYuiaCEcCId/rPrSnlanz59WL16NYsWLeKuu+7ivPPO47bbbmPWrFmsWrWKrl27ct999x3Vvj001BoHJCAgoGG6fr6mpgY4tilk43ljDBMnTuSNN944YXwzZszggw8+YOjQobz00kt8+eWXgJWM7rzzTgoKCkhPT+fcc8+lrKyM2NhYMjIymvyuiIiIhum7776bc845h/fff5+dO3cyYcKEE8bhbrytzX+qhhyxDZNVgZF01eEplWox+/btIzw8nGuvvZZbb72V1atXNxT6CQkJlJaW8s477zT7e3fv3s3y5csBeP311znzzDOPWj9mzBiWLVvGtm3bAOtexZYtW475npKSEjp16oTT6eS1115rWB4ZGcnIkSOZPXs2kydPJjAwkOjoaNLS0nj77bcBq/Beu3Ztk/EVFRXRpYvVb9lLL73UsHzcuHG89dZbAGRlZbF+/fpmxdva/CcRRCQ0TF40oi8dInVUMqVayvr16xk1ahTDhg1jzpw53HXXXcTGxnLjjTcyaNAgLrzwQkaOHNns7+3bty9z586lf//+HD58mF/96ldHrU9MTOSll15i+vTpDBkyhLFjx7Jp06ZjvueBBx5g9OjRjBs3jn79+h21burUqbz66qtMnTq1Ydlrr73GCy+8wNChQxk4cCAffvhhk/Hddttt3HHHHQwfPrzhKgZg1qxZHDx4kAEDBnDXXXcxcOBAYmJi3I63tYkxxtsxNMuIESPMKbUfNgbmxAKw8EcbuHRYSssGppQXbdy4kf79+3s7jBa1c+dOJk+eTGZmprdDabba2lqcTicOh4Pt27dz/vnns3nzZkJCWqfZelP/HkQk3RgzoqntPVpRLiKTgH8CgcDzxpiHG62fATwK7LUXPWWMed5DwTRMju6ZcIINlVLqhykvL+ecc87B6XRijOHpp59utSRwKjy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jH7N79+4T/n4PP/wwYWFhZGRk8Nprr7Fx40bmz5/PsmXLyMjIIDAw8Ki+k06V33TBWWlXDYVrIlC+7iRn7p7yxBNP8P777wOwZ88etm7dSocOHY7a5kTdSl9++eUAnH766bz33nvA8bt5dvX5559zww03NFxZxMfHU1RURGFhIWeffTYA119//VHdSrv+rZ07dwIwduxY/vznP5OTk8Pll19O7969f9DvMX36dADOOussiouLKSws5Ouvv27Yt0suuYS4uLiG7d35/b744gvS09Mb+m2qqKggKSnpB8UJfpQItGpIKc/58ssv+fzzz1m+fDnh4eFMmDDhqC6n652oW+n6rqgDAwMbOnBrbjfP7mrqb1199dWMHj2a//73v1x88cU888wz9OjR47jfERQURF1dXcN84/09WRfartz9/YwxXH/99Tz00EMn38lm8LuqIU0ESrW8oqIi4uLiCA8PZ9OmTXz33XdNbneybqWb+t6munl2NXHiRObNm0d5eTkABQUFxMTEEBcXx9KlSwF45ZVXGq4OjmfHjh306NGDW265hSlTprBu3TqioqIoKSlpcvvk5GTy8vLIz8+nqqrqqNHXAObPnw9Yg9TExMQQExPDWWedxeuvvw5YVVqHDx9u2M/j/X7BwcENV0LnnXce77zzDnl5eQ37umvXrhPulzv8JxFU6z0CpTxl0qRJ1NTU0L9/f26//XbGjBnT5HYn61a6seN189z4b1922WWMGDGCYcOGNdxf+M9//sOtt97KkCFDyMjI4J577mny8/XeeustBg0axLBhw8jMzOS6666jQ4cOjBs3jkGDBnHrrbcetX1wcDD33HMPo0aNYuLEicd0b+1wOBg+fDg33XQTL7zwAgD33nsvX3/9NQMHDuS9996jW7duJ/39Zs6cyZAhQ7jmmmsYMGAADz74IBdccAFDhgxh4sSJ7N+//4T75Q6/6Yb60w0HeH/NXp6YPpzgQL/Jf8pPtIduqNtzt9LNNWHCBB577DFGjGiy12ePa1PdULclFwzsyAUDO3o7DKWUanP8JhEopbyrPXcr3Vz1YyK3F1pHopSPaG/VvMozTuXfgSYCpXyAw+EgPz9fk4GfM8aQn5+Pw9G8zjW1akgpH5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JK+TlNBEop5ec0ESillJ/7f/ZdN+vtLkt5AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "class NonStatBandit:\n",
    "    def __init__(self, arms=10):\n",
    "        self.arms = arms\n",
    "        self.rates = np.random.rand(arms)\n",
    "\n",
    "    def play(self, arm):\n",
    "        rate = self.rates[arm]\n",
    "        self.rates += 0.1 * np.random.randn(self.arms)  # Add noise\n",
    "        if rate > np.random.rand():\n",
    "            return 1\n",
    "        else:\n",
    "            return 0\n",
    "\n",
    "\n",
    "class AlphaAgent:\n",
    "    def __init__(self, epsilon, alpha, actions=10):\n",
    "        self.epsilon = epsilon\n",
    "        self.Qs = np.zeros(actions)\n",
    "        self.alpha = alpha\n",
    "\n",
    "    def update(self, action, reward):\n",
    "        self.Qs[action] += (reward - self.Qs[action]) * self.alpha\n",
    "\n",
    "    def get_action(self):\n",
    "        if np.random.rand() < self.epsilon:\n",
    "            return np.random.randint(0, len(self.Qs))\n",
    "        return np.argmax(self.Qs)\n",
    "\n",
    "\n",
    "runs = 200\n",
    "steps = 1000\n",
    "epsilon = 0.1\n",
    "alpha = 0.8\n",
    "agent_types = ['sample average', 'alpha const update']\n",
    "results = {}\n",
    "\n",
    "for agent_type in agent_types:\n",
    "    all_rates = np.zeros((runs, steps))  # (200, 1000)\n",
    "\n",
    "    for run in range(runs):\n",
    "        if agent_type == 'sample average':\n",
    "            agent = Agent(epsilon)\n",
    "        else:\n",
    "            agent = AlphaAgent(epsilon, alpha)\n",
    "\n",
    "        bandit = NonStatBandit()\n",
    "        total_reward = 0\n",
    "        rates = []\n",
    "\n",
    "        for step in range(steps):\n",
    "            action = agent.get_action()\n",
    "            reward = bandit.play(action)\n",
    "            agent.update(action, reward)\n",
    "            total_reward += reward\n",
    "            rates.append(total_reward / (step + 1))\n",
    "\n",
    "        all_rates[run] = rates\n",
    "\n",
    "    avg_rates = np.average(all_rates, axis=0)\n",
    "    results[agent_type] = avg_rates\n",
    "\n",
    "# plot\n",
    "plt.figure()\n",
    "plt.ylabel('Average Rates')\n",
    "plt.xlabel('Steps')\n",
    "for key, avg_rates in results.items():\n",
    "    plt.plot(avg_rates, label=key)\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
